
let root = new TreeNode(0);
let subNode1 = new TreeNode(1);
let subNode2 = new TreeNode(2);
let subNode11 = new TreeNode(3);
let subNode21 = new TreeNode(4);
subNode2.addChild(subNode21)
subNode1.addChild(subNode11)
root.addChild(subNode1)
root.addChild(subNode2)
let tree = new Tree(root);
console.log('高度为:', tree.treeHeight(root))
tree.levelOrder(root);

let count = tree.nodeCount(root);
console.log("节点数量为:", count)

console.log("前序遍历")
tree.preOrder(root);


console.log("后序遍历")
tree.postOrder(root);

console.log("===============二叉搜索树=============")
let bRoot = new BinaryTreeNode(50,null,null);

let bsTree = new  BinarySearchTree(bRoot);
bsTree.add(new BinaryTreeNode(70,null,null));
bsTree.add(new BinaryTreeNode(30,null,null));
bsTree.add(new BinaryTreeNode(40,null,null));
bsTree.add(new BinaryTreeNode(45,null,null));
bsTree.add(new BinaryTreeNode(35,null,null));
bsTree.add(new BinaryTreeNode(38,null,null));
bsTree.add(new BinaryTreeNode(33,null,null));
bsTree.add(new BinaryTreeNode(10,null,null));
bsTree.add(new BinaryTreeNode(15,null,null));
bsTree.add(new BinaryTreeNode(5,null,null));

let bTree =new BinaryTree(bRoot);
console.log("层级序遍历")
bTree.levelOrder();
console.log("后序遍历")
bTree.postOrder(bRoot)
console.log("前序遍历")
bTree.preOrder(bRoot)
console.log("中序遍历")
bTree.inOrder(bRoot)